
using UnityEngine;
using System.Collections;

public class Bullets : Item
{

    public int m_BulletAmount = 30;
    public MyGUIText m_BulletText;
    public string m_WeaponId = "";

    public int m_InvRows = 3;
    public int m_InvCols = 4;

    bool m_Initialized = false;
    void Start()
    {
        if (m_Initialized == false)
        {
            Initialize();
        }
    }
    public void Initialize()
    {
        m_Initialized = true;

        spaceMatrix = new bool[m_InvRows, m_InvCols];
        this.textGUI = m_BulletText.gameObject;

        description = "Balas para \n armas de tipo: " + m_WeaponId;

    }
    public override void Update()
    {
        base.Update();
        if (InventoryController.GetInstance().IsOpened())
        {
            m_BulletText.SetText(m_BulletAmount.ToString() + " ");
        }
    }
    public override void Use()
    {
        Player.instance.ReloadWeapon(m_WeaponId, this);
        if (m_BulletAmount <= 0)
        {
            InventoryController.GetInstance().GetActiveInventory().RemoveFromInventory(this);
        }
    }
    public override void OnDrop()
    {
        base.OnDrop();
    }
}